<template>
	<view>
		<view style="display: flex;margin-left: 60rpx;margin-top: 40rpx;">
			<view style="width: 180rpx;height: 60rpx;margin-top: 10rpx;">用户：</view>
			<input placeholder="请输入用户名" style="width: 400rpx;height: 60rpx;" disabled="true" :value="username"/>
		</view>
		<view style="display: flex;margin-left: 60rpx;margin-top: 40rpx;">
			<view style="width: 180rpx;height: 60rpx;margin-top: 10rpx;">手机号码：</view>
			<input placeholder="请输入手机号码" style="width: 400rpx;height: 60rpx;" disabled="true" :value="phone" />
		</view>
		<view style="display: flex;margin-left: 60rpx;margin-top: 40rpx;">
			<view style="width: 180rpx;height: 60rpx;margin-top: 10rpx;">比例：</view>
			<input placeholder="请输入比例数值" style="width: 400rpx;height: 60rpx;" type="number" v-model="level"/>
		</view>
		<button style="border-radius: 40rpx;background-color: limegreen;width: 710rpx;margin-left: 20rpx;color: white;margin-top: 20rpx;" @tap="updataInfo">提交</button>
	</view>
</template>

<script>
	let App = getApp();
	import Modal from '@/components/x-modal/x-modal'
	export default {
		components: {
			Modal
		},
		data() {
			return {
				// data: {
				// 	phone: '点击登录',
				// 	balance: 0,
				// 	profit: 0,
				// 	total_num: 0,
				// 	silver:0,
				// 	nextLevel:'无',
				// 	self:0,
				// 	euqs:0,
				// 	self_profit:0,
				// 	friend_profit:0,
				//},
				username:'',
				phone:'',
				uid:'',
				partnerdata:[],
				level:''
			}
			
		},
		onLoad(option) {
			this.uid = option.uid
			console.log(this.uid)
			this.getsignInfo()
			
		},
		onShow() {
			this.sys = App.globalData.sys
		},
		
		methods: {
			
			//跳转到伙伴管理
			goupdata(getid){
				uni.navigateTo({
					url:'/pages/my/updatainfo?uid=getid'
				})
			},
			
			//获取伙伴信息
			
			getsignInfo(){
				let userinfo = uni.getStorageSync('userinfo');
				uni.showLoading({
					title:"加载中"
				})
				this.$api.interfaceApi('getsignuserinfo')({
					'uid':this.uid,
					'id':userinfo.id,
				}).then(res=>{
					if(res.code == 200){
						console.log(res)
						//this.partnerdata = res.data
						this.username = res.data.name
						this.phone = res.data.phone
						this.level = res.data.ratio
					}
					uni.hideLoading()
				})
			},
			//提交信息
			updataInfo(){
				let userinfo = uni.getStorageSync('userinfo');
				uni.showLoading({
					title:"加载中"
				})
				this.$api.interfaceApi('updatausersigninfo')({
					'uid':this.uid,
					'id':userinfo.id,
					'ratio':this.level
				}).then(res=>{
				
					uni.showToast({
						icon:'none',
						title:res.msg
					})
					
					uni.hideLoading()
				})
			},
			
		},
	}
</script>

<style>
</style>